  
package com.xebest.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.xebest.common.util.XeBaseUtil;
import com.xebest.web.controller.export.XeVenLogisticsExport;
import com.xebest.web.form.XeVenOrderLogisticsForm;
import com.xebest.web.mapper.read.XeVenLogisticsCenterExportMapper;
import com.xebest.web.service.XeVenLogisticsCenterExportService;

/**
 * 物流中心导出service
 * @desc: xebest-erp  
 * @author: 赵盼飞  
 * @createTime: 2017年9月7日 上午11:49:07  
 * @history:  
 * @version: v1.0
 */
@Service
public class XeVenLogisticsCenterExportServiceImpl implements XeVenLogisticsCenterExportService {

	@Autowired
	private XeVenLogisticsCenterExportMapper logisticsCenterExportMapper;
	
	/**
	 * 物流单查询导出明细
	 */
	@Override
	public List<XeVenLogisticsExport> queryExLogisticsOrderDetail(XeVenOrderLogisticsForm form) {
		
		List<XeVenLogisticsExport> logisticsExDetail = logisticsCenterExportMapper.queryExLogisticsOrderDetail(form);
		for(XeVenLogisticsExport logistics : logisticsExDetail){
			String areaSend = XeBaseUtil.baseUtil.getOrgAreaName(Integer.parseInt(logistics.getAreaId()));
			logistics.setStoreArea(areaSend);
			
			String areaReceipt = XeBaseUtil.baseUtil.getOrgAreaName(Integer.parseInt(logistics.getCaAreaId()));
			logistics.setReceiptArea(areaReceipt);
			
			String area = XeBaseUtil.baseUtil.getOrgAreaName(Integer.parseInt(logistics.getCaAreaId()));
			logistics.setCaStreet(area+logistics.getCaStreet());
		}
		return logisticsExDetail;  
		
	}

	/**
	 * 物流派车列表导出
	 */
	@Override
	public List<XeVenLogisticsExport> queryExSendCarList(XeVenOrderLogisticsForm form) {
		List<XeVenLogisticsExport> logisticsList = logisticsCenterExportMapper.queryExSendCarList(form);
		for(XeVenLogisticsExport logistics : logisticsList){
			if(!StringUtils.isEmpty(logistics.getCaAreaId())){
				String area = XeBaseUtil.baseUtil.getOrgAreaName(Integer.parseInt(logistics.getCaAreaId()));
				logistics.setReceiptArea(area+" "+logistics.getCaStreet());
			}
		}
		return logisticsList;  
		
	}

}
  
